package ca.unbc.cpsc672.fuzzy.rule;

import ca.unbc.cpsc672.fuzzy.IOUtils;
import ca.unbc.cpsc672.fuzzy.function.MembershipFunction;

public class IfSingleSet implements IfClause {
	private MembershipFunction ipt1;

	/**
	 * IF ipt1
	 * 
	 * @param ipt1
	 * @param opt
	 * @param operator
	 */
	public IfSingleSet(MembershipFunction ipt1) {
		this.ipt1 = ipt1;
	}

	@Override
	public double getSupportLevel(double... iptx) {
		return ipt1.calcProperbility(iptx[0]);
	}

	@Override
	public String toCSVString() {
		StringBuffer sb = new StringBuffer();
		sb.append(IOUtils.getTypeString(this)).append(",");
		sb.append(ipt1.getFullName()).append(",");
		return sb.toString();
	}
	
	@Override
	public MembershipFunction[] getMembershipFunctions() {
		return new MembershipFunction[] { ipt1 };
	}
}
